docs(roadmap): plan full rusqlite DB migration (Phase 6.13–6.17)#652
docs(roadmap): plan full rusqlite DB migration (Phase 6.13–6.17)#652carlos-alm merged 4 commits intomainfrom
Conversation
Plan the complete migration of all DB operations to rusqlite on the native engine path, so better-sqlite3 is only used for WASM fallback: - 6.13: NativeDatabase class (connection lifecycle) - 6.14: Native read queries (41 Repository methods) - 6.15: Native write operations (build pipeline) - 6.16: Dynamic SQL & edge cases - 6.17: Cleanup & better-sqlite3 isolation
|
Claude finished @carlos-alm's task —— View job PR Review: Roadmap Documentation for Rusqlite Migration
|
Greptile SummaryThis PR adds five new roadmap sub-phases (6.13–6.17) to Confidence Score: 5/5Docs-only roadmap change; no code modified; prior dep-count concern resolved; safe to merge. The only changed file is a roadmap Markdown document. The previously raised concern about the incorrect '3→4 deps' claim has been addressed in the latest commit. The single remaining note (task duplication between 6.15 and 6.17) is editorial and does not block merging. Phase numbering is sequential and internally consistent. No files require special attention — this is a documentation-only PR. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["6.13 — NativeDatabase class\n(rusqlite connection lifecycle)"]
B["6.14 — Native Read Queries\n(41 Repository methods → Rust)"]
C["6.15 — Native Write Operations\n(build-pipeline writes → Rust)"]
D["6.16 — Dynamic SQL & Edge Cases\n(NodeQuery builder, WAL, advisory locks)"]
E["6.17 — Cleanup & Isolation\nbetter-sqlite3 lazy-load, README update"]
A --> B
A --> C
B --> D
C --> D
D --> E
subgraph result["End state"]
F["Native engine → rusqlite only"]
G["WASM engine → better-sqlite3 only"]
end
E --> result
Reviews (2): Last reviewed commit: "fix(roadmap): correct dep count claim in..." | Re-trigger Greptile |
docs/roadmap/ROADMAP.md
Outdated
| - **Lazy-load `better-sqlite3`** — only `require()` it when engine is WASM; native path never touches it | ||
| - **Remove the double-connection pattern** — `bulk_insert_ast_nodes` (6.9) and any other Rust functions that open their own `rusqlite::Connection` should use the shared `NativeDatabase` instance | ||
| - **Profile and tune:** Enable `rusqlite` statement caching, optimize batch sizes, tune WAL settings for the unified Rust connection | ||
| - **Update README.md** — change "3 runtime dependencies" to "4 runtime dependencies" with the claim: `better-sqlite3` is WASM-engine only, `rusqlite` is native-engine only |
There was a problem hiding this comment.
"4 runtime dependencies" claim may not hold
The plan says to bump the README from "3 runtime dependencies" to "4 runtime dependencies," citing rusqlite as a new dep. However, rusqlite is a Rust crate compiled into the native addon binary — it's not a separate npm runtime dependency visible to users. From an npm perspective the count would stay the same (or even drop by one if better-sqlite3 becomes optional/conditional on WASM).
A more accurate framing might be: "The project's SQLite backend is now split — WASM engine uses better-sqlite3 (npm), native engine uses rusqlite (compiled into the addon)" — without changing the raw dependency count claim unless you can verify that the count actually changes.
It's worth pinning down the exact README wording in this phase's acceptance criteria so the implementer doesn't have to re-evaluate it then.
Context Used: CLAUDE.md (source)
There was a problem hiding this comment.
Good catch — fixed in 82492b8. Removed the "3 → 4" dep count bump since rusqlite is compiled into the native addon binary, not a separate npm runtime dependency. The bullet now reads: clarify that better-sqlite3 is WASM-engine only, and the dep count stays at 3.

Summary
rusqliteon the native engine pathbetter-sqlite3becomes WASM-only,rusqlitebecomes native-only — eliminating the dual-SQLite-in-one-process problemPhases
NativeDatabasenapi-rs class with connection lifecycleRepositoryread methods to RustNodeQuerybuilder) and edge casesbetter-sqlite3lazy-loading isolation, README update (3→4 deps)Context
PR #651 introduced
rusqlitefor bulk AST node insertion, butbetter-sqlite3still handles all other DB operations for both engines. This roadmap plans the full migration so the native engine never touchesbetter-sqlite3.Test plan